<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<!doctype html>
<html>
<head>
<style type="text/css">
* {
	margin: 0px;
	padding: 0px;
	font-size: 12px;
}
</style>
</head>
<body class="gray-bg">

	<!-- 隐藏域 -->
	<input type="hidden" id="id" name="id" />
	<input type="hidden" id="busi_id" name="busi_id" />
	<!-- 隐藏域 -->

	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;&nbsp;财务相关&nbsp;&gt;&nbsp;确认退押金</span>
		</div>
		<div class="ibox-content ibox-con">
			<div class="tche-padding">
				<button type="button" class="btn dpbtn_blue btnaplly"
					onclick="save();">确认退押金</button>
			</div>
			<%@include file="/jsp/common_yw_with_loan_include.jsp"%>
			<div class="business-manwife">退押金信息</div>
			<div class="business-padding">
				<table cellpadding="0" cellspacing="0" border="0" class="table-list">
					<tr>
						<td>签约贷款额</td>
						<td id="sign_loan_amount" name="sign_loan_amount">&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td>还款情况</td>
						<td id="yq_count" name="yq_count">&nbsp;</td>
						<td id="jq_count" name="jq_count">&nbsp;</td>
						<td>当前逾期0元</td>
					</tr>
					<tr>
						<td>征信押金</td>
						<td id="credit_real" name="credit_real">&nbsp;</td>
						<td>续保押金</td>
						<td id="deposit_insure_real" name="deposit_insure_real">&nbsp;</td>
					</tr>
					<tr>
						<td>履约押金</td>
						<td id="deposit_performing_real" name="deposit_performing_real">&nbsp;</td>
						<td>抵押押金</td>
						<td id="deposit_real" name="deposit_real">&nbsp;</td>
					</tr>
				</table>
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="commentForm">
						<table cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td width="50%">
									<div class="form-group">
										<label class="col-sm-3 control-label np">退款项目：</label>
										<div class="col-sm-8">
											<input id="typeRefund" name="typeRefund" minlength="1"
												maxlength="20" type="text" class="form-control" required=""
												aria-required="true" placeholder="退款项目" readonly="readonly">
										</div>
									</div>
								</td>
								<td width="50%">
									<div class="form-group">
										<label class="col-sm-3 control-label np">退款银行：</label>
										<div class="col-sm-8">
											<input id="bank" name="bank" minlength="1" maxlength="20"
												type="text" class="form-control" required=""
												aria-required="true" placeholder="退款银行" readonly="readonly">
										</div>
									</div>
								</td>
							</tr>
							<tr>
								<td width="50%">
									<div class="form-group">
										<label class="col-sm-3 control-label np">退款单位：</label>
										<div class="col-sm-8">
											<input id="departmentRefund" name="departmentRefund"
												minlength="1" maxlength="20" type="text"
												class="form-control" required="" aria-required="true"
												placeholder="退款单位" readonly="readonly">
										</div>
									</div>
								</td>
								<td width="50%">
									<div class="form-group">
										<label class="col-sm-3 control-label np">银行账号：</label>
										<div class="col-sm-8">
											<input id="cardnoRefund" name="cardnoRefund" minlength="1"
												maxlength="20" type="creditcard" class="form-control"
												required="" aria-required="true" placeholder="银行账号"
												readonly="readonly">
										</div>
									</div>
								</td>
							</tr>
							<tr>
								<td width="50%">
									<div class="form-group">
										<label class="col-sm-3 control-label np">申请金额：</label>
										<div class="col-sm-8">
											<input id="amountApply" name="amountApply" minlength="1"
												maxlength="20" type="digits" class="form-control"
												required="" aria-required="true" placeholder="申请金额"
												readonly="readonly">
										</div>
									</div>
								</td>
								<td width="50%">
									<div class="form-group">
										<label class="col-sm-3 control-label np">实际金额：</label>
										<div class="col-sm-8">
											<input id="amountRefund" name="amountRefund" minlength="1"
												maxlength="20" type="digits" class="form-control"
												required="" aria-required="true" placeholder="实际金额"
												readonly="readonly">
										</div>
									</div>
								</td>
							</tr>
							<tr>
								<td width="50%">
									<div class="form-group">
										<label class="col-sm-3 control-label np">退款方式：</label>
										<div class="col-sm-8">
											<input id="typeRemit" name="typeRemit" minlength="1"
												maxlength="20" type="digits" class="form-control"
												required="" aria-required="true" placeholder="实际金额"
												readonly="readonly">
										</div>
									</div>
								</td>
								<td width="50%">
									<div class="form-group">
										<label class="col-sm-3 control-label np">备注：</label>
										<div class="col-sm-8">
											<textarea id="remarks" name="remarks" class="form-control"
												required="" aria-required="true" disabled="disabled"></textarea>
										</div>
									</div>
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
			<div class="business-manwife">代垫附件</div>
			<div class="business-padding">
				<div class="zx-addimg">
					<ul id="TUI_KUAN_FU_JIAN">
						<li><img
							filelabel="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }"
							src="${basePath}/img/shangchuanzhaopian.png" width="110px"
							height="110px"
							class="zx-imgPre ${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }">
							<span
							filelabelDelSpan="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }"
							class="hidden bt-cancle glyphicon glyphicon-trash"
							onclick="deleleFileRecord(this,'${attachmentLabelNameValues.TUI_KUAN_FU_JIAN_FUJIAN1 }',false);"></span>
							<div class="img-layer">
								<div></div>
								<span
									filelabelLabelSpan="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }">${attachmentLabelNameValues.TUI_KUAN_FU_JIAN_FUJIAN1 }</span>
							</div>
							<div
								filelabelDiv="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }"
								class="hidden button-des">
								<a type="button"
								class="abuttonStylele"  filelabelADown="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN1 }"
									download="shangchuanzhaopian.png"
									href="${basePath}/img/shangchuanzhaopian.png">下载</a> <a
								type="button" class="abuttonStyleri"  onclick="showImg(this);">详情</a>
							</div> <a href="javascript:void(0);" class="file"> <span>上传资料</span>
								<input type="file"
								accept="image/gif,image/jpeg,image/bmp,image/png,image/jpg"
								onchange="uploadFile(this,'${modeIDTypeNames.TUIKUAN}','SHEN_FEN_ZHENG_MING', false, false);" />
						</a></li>
						<li><img
							filelabel="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }"
							src="${basePath}/img/shangchuanzhaopian.png" width="110px"
							height="110px"
							class="zx-imgPre ${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }">
							<span
							filelabelDelSpan="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }"
							class="hidden bt-cancle glyphicon glyphicon-trash"
							onclick="deleleFileRecord(this,'${attachmentLabelNameValues.TUI_KUAN_FU_JIAN_FUJIAN2 }',false);"></span>
							<div class="img-layer">
								<div></div>
								<span
									filelabelLabelSpan="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }">${attachmentLabelNameValues.TUI_KUAN_FU_JIAN_FUJIAN2 }</span>
							</div>
							<div
								filelabelDiv="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }"
								class="hidden button-des">
								<a type="button"
								class="abuttonStylele"  filelabelADown="${attachmentLabelNames.TUI_KUAN_FU_JIAN_FUJIAN2 }"
									download="shangchuanzhaopian.png"
									href="${basePath}/img/shangchuanzhaopian.png">下载</a> <a
								type="button" class="abuttonStyleri"  onclick="showImg(this);">详情</a>
							</div> <a href="javascript:void(0);" class="file"> <span>上传资料</span>
								<input type="file"
								accept="image/gif,image/jpeg,image/bmp,image/png,image/jpg"
								onchange="uploadFile(this,'${modeIDTypeNames.TUIKUAN}','SHEN_FEN_ZHENG_MING', false, false);" />
						</a></li>
					</ul>
				</div>
			</div>
			<div class="business-manwife">财务退款</div>
			<div class="padding-nono">
				<table cellpadding="0" cellspacing="0" border="0"
					class="buyinfor-table">
					<tr>
						<td align="right"><label class="control-label np">打款时间：</label>
						</td>
						<td><input id="" name="" placeholder="财务审核时间"
							class="laydate-icon form-control" onclick="laydate()" /></td>
						<td align="right"><label class="control-label np">退款账号：</label>
						</td>
						<td><select class="form-control" id="cardno_refund_company"
							name="cardno_refund_company">&nsbp;
						</select></td>
					</tr>
				</table>
			</div>

			<div class="business-manwife">经办信息</div>
			<div class="padding-nono">
				<table cellpadding="0" cellspacing="0" border="0"
					class="buyinfor-table">
					<tr>
						<td align="right"><label class="control-label np">经办人：</label>
						</td>
						<td><input class="form-control" type="text" id="uname"
							name="uname" readonly="readonly"
							value="${current_user_key.uname}" /></td>
						<td align="right"><label class="control-label np">经办时间：</label>
						</td>
						<td><input id="jb_time" name="jb_time" placeholder="经办时间"
							class="laydate-icon form-control" /></td>
					</tr>
				</table>
			</div>
			</form>
		</div>
	</div>
	</div>

	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>

	<!-- layerDate plugin javascript -->
	<script type="text/javascript"
		src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>

	<!-- 文件上传 -->
	<%@include file="/jsp/common_fileupload_include.jsp"%>

	<!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
	<script type="text/javascript">
	
    	$(function(){
    		var date = new Date();
	    	document.getElementById("jb_time").value = date.format("yyyy-MM-dd h:m:s");
	    	
	    	var id = $.getUrlData("id");
	    	var busi_id = $.getUrlData("busi_id");
	    	
	    	$('#id').val(id);
	    	$('#busi_id').val(busi_id);
	    	
	    	initData();
    	});
    	
    	
    	var initData = function()
    	{
    		 //附件
    		 var busi_id = $('#busi_id').val();
			 showAttentment(busi_id, '', '${modeIDTypeNames.TUIKUAN }');
			 
			 $.dpAjax({
			   		url:'${basePath}/CustomController/getRefundInformationEntity',
			   		data:{
			   			"busi_id":busi_id
			   		},
					success: function(datas)
					{
				 	  if(datas.flag == "100100"){
				 		  
				 		  var d = datas.result;
				 		  
				 		  if(null != d && d != 'null' && d != '')
				 		  {
				 			 $('#sign_loan_amount').html(d.signLoanAmount+"元");
					 		  $('#yq_count').html("累计逾期"+d.yqCount+"次");
					 		  if(d.jq_count > 0)
					 		  {
					 			  $('#jq_count').html("已结清");
					 		  }
					 		  else
					 		  {
					 			 $('#jq_count').html("未结清");
					 		  }
					 		  $('#credit_real').html(d.creditReal);
					 		  $('#deposit_insure_real').html(d.depositInsureReal);
					 		  $('#deposit_performing_real').html(d.depositPerformingReal);
					 		  $('#deposit_real').html(d.depositReal);
				 		  }
				 		 
						  return;
					  }
					  if(datas.flag == "100200"){
						  alert(JSON.stringify(datas));
			              return;
			          }
					  layer.msg(datas.message, {icon: 2});
					}
			 });
			 
			 var id = $('#id').val();
			 
			 $.dpAjax({
				 	show:false,
			   		url:'${basePath}/DhDepositMoneyController/getById',
			   		data:{
			   			"id":id
			   		},
					success: function(datas)
					{
				 	  if(datas.flag == "100100"){
				 		  
				 		  var d = datas.result;
				 		  
				 		  $('#typeRefund').val(d.typeRefund);
				 		  $('#bank').val(d.bank);
				 		  $('#departmentRefund').val(d.departmentRefund);
				 		  $('#cardnoRefund').val(d.cardnoRefund);
				 		  $('#amountApply').val(d.amountApply);
				 		  $('#amountRefund').val(d.amountRefund);
				 		  $('#typeRemit').val(d.typeRemit);
				 		  $('#remarks').val(d.remarks)
						  return;
					  }
					  if(datas.flag == "100200"){
						  alert(JSON.stringify(datas));
			              return;
			          }
					  layer.msg(datas.message, {icon: 2});
					}
			 });
			 
			 
			 $.dpAjax({
				 	show:false,
			   		url:'${basePath}/CustomController/getDataZiDianTuiCard',
			   		data:{
			   			"id":id
			   		},
					success: function(datas)
					{
				 	  if(datas.flag == "100100"){
				 		 
				 		 var d = datas.result;
				 		 var objs = '';
				 		 for(var key in d)  
				 		 {
				 			objs += '<option value="'+d[key]+'">'+d[key]+'</option>';
				 		 }
				 		 $('#cardno_refund_company').html(objs);
						 return;
					  }
					  if(datas.flag == "100200"){
						  alert(JSON.stringify(datas));
			              return;
			          }
					  layer.msg(datas.message, {icon: 2});
					}
			 });
    	}
    	
    	var save = function()
    	{
    		var id = $('#id').val();
    		var cardno_refund_company = $('#cardno_refund_company').val();
    		
    		$.dpAjax({
			   		url:'${basePath}/DhDepositMoneyController/modify',
			   		data:{
			   			"id":id,
			   			"statusRefundDeposit":20,
			   			"cardnoRefundCompany":cardno_refund_company
			   			
			   		},
					success: function(datas)
					{
				 	  if(datas.flag == "100100"){
				 		 window.location.href = "${basePath}/web/system/information/customerMonReturnList.jsp";
				 		 layer.msg("确认退押金执行成功！", {icon: 6});
						 return;
					  }
					  if(datas.flag == "100200"){
						  alert(JSON.stringify(datas));
			              return;
			          }
					  layer.msg(datas.message, {icon: 2});
					}
			 });
    	}
		
    </script>
</body>
</html>
